package tankgame01;

import javax.swing.*;
import java.awt.*;

public class MyPanle extends JPanel {
    Hero hero = null;
    public MyPanle(){
        hero=new Hero(100,100);
    }

    @Override
    public void paint(Graphics g) {
        super.paint(g);
        g.fillRect(0,0,1000,750);


        //画坦克
        drawTank(200,300,g,0,0);

    }
    //画坦克方法
    public void drawTank( int x,int y,Graphics g,int dirct,int type){
        switch (type){
            case 0://自己的tank
                g.setColor(Color.cyan);
                break;
            case 1://敌人的tank
                g.setColor(Color.yellow);
                break;
        }
        switch (dirct){
            case 0: //向上
                g.fill3DRect(x,y,10,60,false);
                g.fill3DRect(x+30,y,10,60,false);
                g.fill3DRect(x+10,y+10,20,40,false);
                g.fillOval(x+10,y+20,20,20);
                g.drawLine(x+20,y,x+20,y+20);

            default:
                System.out.println("暂时未做处理");
        }


    }

}
